





let axios = require("axios")
let fs = require("fs");

let page = 1;

let alllist = []

fetchdata()

function fetchdata (flag) {
    console.log("正在请求" + page);
    axios.default("https://palworld.caimogu.cc/breed?seed1=0&seed2=0&result=0&page=" + page, {
        method:"get",
        headers: {
            "Cookie": "Hm_lvt_682a4cb86196fbaa548f815fd76cd6b0=1705986096; CAIMOGU=f1828e15b0a13fec7b3e4bb32efcd207; Hm_lpvt_682a4cb86196fbaa548f815fd76cd6b0=1706066059",
            "Accept": "application/json, text/javascript, */*; q=0.01",
            "Referer": "https://palworld.caimogu.cc/breed.html",
            "X-Requested-With":"XMLHttpRequest",
            "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36",
        }
    }).then(ret => {
        if (ret.data.data.list && ret.data.data.list.length > 0) {
            page++
            alllist = alllist.concat(ret.data.data.list)
            if(flag) {return}
            fetchdata()
        } else {
            console.log("请求结束");
            fs.writeFileSync("./peizhongdata.js", JSON.stringify(alllist))
        }
    })

}

